import java.util.Stack;

public class MyStack {
    private int[] arr;
    private int top;

    public MyStack(int k) {
        arr = new int[k];
    }

    //入栈
    public boolean push(int val) {
        if(isFully()) {
            return false;
        }
        arr[top++] = val;
        return true;
    }

    //出栈
    public int pop() {
        if(isEmpty()) {
            return -1;
        }
        int ret = arr[top-1];
        top--;
        return ret;
    }

    public int peek() {
        if(isEmpty()) {
            return -1;
        }

        return arr[top-1];
    }

    public boolean isFully() {
        return top == arr.length;
    }



    public boolean isEmpty() {
        return top == 0;
    }

}
